﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="wfOrderList.aspx.cs" Inherits="msBsc.WebUi.wMall.Seller.wfOrderList" %>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>地接客_订单列表</title>
    <link href="/themes/wStyle1/css/sLayout.css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/sHead.css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/sFoot.css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/from.css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/pagination.css" rel="stylesheet" />

    <link href="/themes/wStyle1/css/orderlist.css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/usermenu.css" rel="stylesheet" />

    <link href="/jqPlugin/layer/skin/layer.css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/Chat/layim.css" rel="stylesheet" />
</head>
<body>
    <div class="wf_all">
        <div id="divLoginInfo">
            <%=msBsc.WebUi.Code.QtHtmlGet.GetHeaderLoginInfo() %>
        </div>
        <div class="main-container">
            <div class="sidebar-scroll noborder">
                <%=msBsc.WebUi.Code.QtHtmlGet.GetDjackMenuHtml() %>
            </div>
            <div class="main-Info">
                <div class="tnavigation">
                    <a class="nav" href="#">首页</a>&gt;
				<a class="nav" href="#">订单管理</a>&gt;
				<a class="nav-on" href="#">我的订单</a>
                </div>
                <div class="listmenu">
                    <ul id="wSlist" class="list">
                        <li class="selected" onclick="selectStatus(this,0);" tabindex="0">
                            <a class="link" data-spm="d2" href="javascript:;">
                                <span>所有订单</span>
                                <em class="tm-h">0</em>
                                <i class="interval">|</i>
                            </a>
                        </li>
                        <li onclick="selectStatus(this,1);" tabindex="1">
                            <a class="link" data-spm="d2" href="javascript:;">
                                <span>待确认</span>
                                <em class="tm-h">0</em>
                                <i class="interval">|</i>
                            </a>
                        </li>
                        <li onclick="selectStatus(this,2);" tabindex="2">
                            <a class="link" data-spm="d2" href="javascript:;">
                                <span>待付款</span>
                                <em class="tm-h">0</em>
                                <i class="interval">|</i>
                            </a>
                        </li>
                        <li onclick="selectStatus(this,3);" tabindex="3">
                            <a class="link" data-spm="d2" href="javascript:;">
                                <span>已付款</span>
                                <em class="tm-h">0</em>
                                <i class="interval">|</i>
                            </a>
                        </li>
                        <li onclick="selectStatus(this,6);" tabindex="4">
                            <a class="link" data-spm="d2" href="javascript:;">
                                <span>要求退款</span>
                                <em class="tm-h">0</em>
                                <i class="interval">|</i>
                            </a>
                        </li>
                        <li onclick="selectStatus(this,4);" tabindex="5">
                            <a class="link" data-spm="d2" href="javascript:;">
                                <span>已完成</span>
                                <em class="tm-h">0</em>
                                <i class="interval">|</i>
                            </a>
                        </li>
                    </ul>
                    <div class="wrap-line">
                        <span id="sold-boder" class="line" style="left: 0px;"></span>
                    </div>
                </div>
                <div style="margin-left: -5px;" id="orderList">
                    <p style="width: 200px; margin-left: 30px;" class="car-price">数据加载中请稍后...</p>
                </div>
                <xmp id="svc_list_temp_order" style="display: none">
                    {{#for(var i=0,len=d.rows.length;i < len;i++){ }}
                       <table class="table-info m-top1">
                        <thead class="table-head">
                            <tr>
                                <th class="w2">下单时间:{{formatDate1(new Date(d.rows[i].ORDER_TIME))}}</th>
                                <th class="w2">订单编号:{{d.rows[i].ORDER_CODE}}</th>
                                <th class="w2" style="width:22%">
                                    <a href="#" title="{{d.rows[i].CUSTOMER_NICK}}">{{getNick(d.rows[i].CUSTOMER_NICK)}}</a>
                                    <span onclick="chatShow(this);"  style="cursor:pointer;color:#ff6a00;" lg="true" 
                                        userid="{{d.rows[i].ORDER_BUYER_ID}}" 
                                        username="{{d.rows[i].CUSTOMER_NICK}}" userface="{{d.rows[i].CUSTOMER_DEFAULT_PIC}}" >
                                    <img alt="在线咨询" src="/themes/wStyle1/Images/Chat/contact.gif" /></span>
                                </th>
                                <th style="width:15%">定金(元)</th>
                                <th>状态</th>
                            </tr>
                        </thead>
                        <tbody class="car-body">
                            <tr>
                                <td>
                                    <img class="user-img" src="{{d.rows[i].CUSTOMER_DEFAULT_PIC}}" />
                                </td>
                                <td class="car-info">
                                     <p>{{d.rows[i].ORDER_CONTENT}}</p>
                                    {{# if(!d.rows[i].ORDER_RMK=="") { }}
                                       <p>备注：<span>{{d.rows[i].ORDER_RMK}}</span></p>
                                    {{#} }}
                                </td>
                                <td class="center-text">{{formatDate1(new Date(d.rows[i].ORDER_START_TIME))}}--{{formatDate1(new Date(d.rows[i].ORDER_STOP_TIME))}}</td>
                                <td class="center-text pric-boder">
                                    <p >应付定金:<span class="car-price">￥{{d.rows[i].PAYABLE_AMT}}</span></p>
                                </td>
                                <td class="center-text">{{getStatus(d.rows[i].ORDER_STATUS,d.rows[i].ORDERS_INFO_ID,d.rows[i].ORDER_START_TIME)}}</td>
                            </tr>
                        </tbody>
                    </table>
                    {{#} }}
                  </xmp>
                <div id="divPage">
                </div>
            </div>
        </div>

        <%--chat--%>
        <script src="/themes/wStyle1/js/Chat/lib.js"></script>
        <script src="/themes/wStyle1/js/Chat/layim.js"></script>

        <!--start JS引用-->
        <script src="/jqPlugin/js/jquery-1.8.3.min.js"></script>
        <script src="/jqPlugin/js/jBase.js"></script>
        <script src="/jqPlugin/js/jBPage.js"></script>
        <script src="/themes/wStyle1/js/comm/jsPagination.js"></script>

        <script src="/themes/wStyle1/js/comm/VerifyJs.js"></script>
        <script src="/jqPlugin/layer/layer.min.js"></script>
        <script src="/jqPlugin/js/laytpl.js"></script>

        <script src="/jqPlugin/SelectSimu/js/SelectSimu.js"></script>
        <script src="/themes/wStyle1/js/comm/jsLayout.js"></script>
        <script src="/themes/wStyle1/js/comm/DateInfo.js"></script>
        <!--end JS引用-->
        <script type="text/javascript">
            var pIndex = 1, ostatus = 0;
            function btnDo(sEbtn) {
                GtGrid1Action = sEbtn;
                var opart = GetGtParam();
                
                ajaxComm(opart);
            };

            function selectStatus(t, st) {
                $(t).parent().children().removeClass("selected");
                $(t).addClass("selected");

                var tbindex = parseInt($(t).attr("tabindex"));
                $("#sold-boder").attr("style", "left: " + (tbindex * 109) + "px;");

                ostatus = st;
                pIndex = 1;
                btnDo("init");
                layer.load('数据请求中,请稍后', 1);
            }

            //拒绝订单 效果
            function refuseOrder(orderid) {
                var t = this;
                $.layer({
                    title: ['请填写拒绝理由，为什么要伤害我', true],
                    shade: [0.5, '#000', true],
                    area: ['auto', 'auto'],
                    dialog: {
                        msg: '<textarea id="message" style="width:320px;height:130px;"></textarea>',
                        btns: 2,
                        type: 4,
                        btn: ['残忍拒绝', '我再想想'],
                        yes: function (s) {
                            var msg = $("#message").val();
                            var reg = /\S/;
                            if (reg.test(msg)) {
                                layer.load('正在为你传达,请稍后', 2);
                                stServer_Refuse(orderid, msg);
                            }
                            else {
                                layer.tips('为什么呢？', $("#message"), { guide: 0, time: 2 });
                            }
                        },
                        no: function () { }
                    }
                });

            }

            //成功效果
            function success() {
                layer.alert('操作成功', 1);
                setTimeout(function () {
                    location.reload();
                }, 2000);
            }

            //拒绝 提交
            function stServer_Refuse(orderid, msg) {
                var opart = new jsonRow();
                opart.AddCell("message", msg);
                opart.AddCell("orderId", orderid);
                opart.AddCell("ACTION", "refuse");
                ajaxComm(opart);
            }

            //执行AJAX调用时获取参数
            function GetGtParam() {
                var _jsParam = new jsonRow();
                _jsParam.AddCell("pIndex", pIndex);
                _jsParam.AddCell("orderStatus", ostatus);
                _jsParam.AddCell("ACTION", GtGrid1Action);
                return _jsParam;
            };
            btnDo("init");
            function goPage(Index) {
                pIndex = Index;
                btnDo("init");
            }
            //获取游客 昵称
            function getNick(name) {
                var nick = name.toString();
                if (nick.length > 5) {
                    nick = nick.substring(0, 5) + "...";
                }
                return nick;
            }
            //获取订单时间
            function getTime(t, str) {
                var time = t.split('/');
                var newtime = Array();
                newtime.push(time[0]);
                newtime.push(time[1]);
                newtime.push(time[2]);
                return newtime.join(str);
            }
            //删除订单
            function delOrder(orderid) {
                $.layer({
                    title: ['我是提示信息', true],
                    shade: [0.5, '#000', true],
                    area: ['auto', 'auto'],
                    dialog: {
                        msg: '你确认要删除该订单？删除后无法恢复，确认继续？',
                        btns: 2,
                        type: 4,
                        btn: ['确认', '我再想想'],
                        yes: function () {
                            layer.load('正在为你处理,请稍后', 2);
                            var opart = new jsonRow();
                            opart.AddCell("orderId", orderid);
                            opart.AddCell("ACTION", "del");
                            ajaxComm(opart);
                        },
                        no: function () { }
                    }
                });

            }

            //获取订单操作状态
            function getStatus(status, orderid, statTime) {
                var st = parseInt(status);
                var statushtml = "";
                var newTime = new Date(statTime);
                var isdel = new Date() >= newTime;

                switch (st) {
                    case 1:
                        statushtml += '<p class="skin-yellow">待确认</p>';
                        if (!isdel) {
                            statushtml += '<p><a target="_blank" href="/ws_OrderConfirm.htm?orderId=' + orderid + '">确认订单</a></p>';
                            statushtml += '<p><a href="javascript:refuseOrder(\'' + orderid + '\');">拒绝订单</a></p>';
                        }
                        break;
                    case 12:
                        statushtml += '<p class="skin-red">已拒绝</p>';
                        break;
                    case 2:
                        statushtml += '<p class="skin-yellow">待付款</p>';
                        break;
                    case 3:
                        isdel = false;
                        statushtml += '<p class="skin-greem">已支付</p>';
                        break;
                    case 4:
                        isdel = false;
                        statushtml += '<p class="skin-greem">已完成</p>';
                        statushtml += '<p><a title="删除订单"  href="javascript:delOrder(\'' + orderid + '\')" >删除订单</a></p>';
                        break;
                    case 6:
                        isdel = false;
                        statushtml += '<p class="skin-red">要求退款</p>';
                        statushtml += '<p><a target="_blank" href="/ws_ApplyRefund.htm?orderId=' + orderid + '">退款处理</a></p>';
                        break;
                    case 7:
                        isdel = false;
                        statushtml += '<p class="skin-yellow">已退款</p>';
                        statushtml += '<p><a title="删除订单"  href="javascript:delOrder(\'' + orderid + '\')" >删除订单</a></p>';
                        break;
                    case 8:
                        isdel = false;
                        statushtml += '<p class="skin-yellow">已取消</p>';
                        statushtml += '<p><a title="删除订单"  href="javascript:delOrder(\'' + orderid + '\')" >删除订单</a></p>';
                        break;
                    case 11:
                        statushtml += '<p class="skin-yellow">已拒绝退款</p>';
                        break;
                    case 13:
                        isdel = false;
                        statushtml += '<p class="skin-greem">已退款</p>';
                        statushtml += '<p><a title="删除订单"  href="javascript:delOrder(\'' + orderid + '\')" >删除订单</a></p>';
                        break;
                }
                if (!isdel) {
                    statushtml += '<p><a target="_blank" href="/ws_OrderInfo.htm?orderId=' + orderid + '">订单详情</a></p>';
                }
                else {
                    statushtml += '<p><a title="订单已过期"  href="javascript:delOrder(\'' + orderid + '\')" >删除订单</a></p>';
                    statushtml += '<p><a target="_blank" href="/ws_OrderInfo.htm?orderId=' + orderid + '">订单详情</a></p>';
                }
                return statushtml;
            }

            //获取订单数量
            function setAllCount(dt) {
                var wlist = $("#wSlist").children();
                var data = dt.rows[0];
                $(wlist).eq(0).find("em").html(data.sumcount);
                $(wlist).eq(1).find("em").html(data.daiquerren);
                $(wlist).eq(2).find("em").html(data.daifukuan);
                $(wlist).eq(3).find("em").html(data.yifukuan);
                $(wlist).eq(4).find("em").html(data.tuikuan);
                $(wlist).eq(5).find("em").html(data.wanchen);
            }
        </script>
        <script src="/themes/wStyle1/js/Chat/chatMessage.js"></script>
        <%=msBsc.WebUi.Code.QtHtmlGet.GetFloorHtml() %>
    </div>
</body>
</html>
